-
-
Notifications
You must be signed in to change notification settings - Fork 480
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cythonize GraphicMatroid
#37839
Cythonize GraphicMatroid
#37839
Conversation
Documentation preview for this PR (built with commit 9fda0f7; changes) is ready! 🎉 |
Remove `_find` & `_union`. Remove `DisjointSet_of_integers` `_d` attribute from `DisjointSet_of_hashables` (and adjust code). Add notes recommending `OP_find` and `OP_union` if no input checking needed. Touch-up docstrings.
00cc8bd
to
a51c093
Compare
The methods `find` and `union` of the class `DisjointSet_of_hashables` pass through an unnecessary layer of input checks that slow down the code. I avoided these checks, cythonized more of the code, and edited the docstrings. I can attest to the fact that these changes improve speed, and in a follow-up PR (sagemath#37839) I mention a test that confirms this. URL: sagemath#37835 Reported by: gmou3 Reviewer(s): gmou3, Martin Rubey, Travis Scrimshaw, Vincent Delecroix
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It might be good to look at the C code generated in performance critical sections to see if there are additional places where type casting and other such declarations could simplify the C code (and hence, increase performance). Although I am basically okay to include this in the current state and do other general improvements in later PRs. It is up to you.
Co-authored-by: Travis Scrimshaw <clfrngrown@aol.com>
I hadn't thought of doing that and I'll keep the idea in mind for future PRs. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, then let's get this in. It seems like the tester failures are unrelated, but it would be good to have them be run... I don't know how to kick it to run it again.
Please don't kick it as it may further break things. |
I've repaired the CI, which complains:
|
Something is wrong with the CI. There is no more |
Indeed, sorry for the noise. |
A metamorphosis of `graphic_matroid.py` into `graphic_matroid.pyx` and `graphic_matroid.pxd`. Things should be somewhat faster; test, e.g., the `GraphicMatroid`'s `_circuit` function. An indirect and diluted test that shows improvement can be seen by running `%time matroids.CompleteGraphic(8).circuits()` (~half the time). `For the reviewer:` The changes of this PR are only inside the `matroids` module. The rest come from sagemath#37835. ### ⌛ Dependencies sagemath#37835: Deeper improvements of `DisjointSet`. URL: sagemath#37839 Reported by: gmou3 Reviewer(s): gmou3, Kwankyu Lee, Travis Scrimshaw
A metamorphosis of `graphic_matroid.py` into `graphic_matroid.pyx` and `graphic_matroid.pxd`. Things should be somewhat faster; test, e.g., the `GraphicMatroid`'s `_circuit` function. An indirect and diluted test that shows improvement can be seen by running `%time matroids.CompleteGraphic(8).circuits()` (~half the time). `For the reviewer:` The changes of this PR are only inside the `matroids` module. The rest come from sagemath#37835. ### ⌛ Dependencies sagemath#37835: Deeper improvements of `DisjointSet`. URL: sagemath#37839 Reported by: gmou3 Reviewer(s): gmou3, Kwankyu Lee, Travis Scrimshaw
A metamorphosis of
graphic_matroid.py
intographic_matroid.pyx
andgraphic_matroid.pxd
.Things should be somewhat faster; test, e.g., the
GraphicMatroid
's_circuit
function. An indirect and diluted test that shows improvement can be seen by running%time matroids.CompleteGraphic(8).circuits()
(~half the time).For the reviewer:
The changes of this PR are only inside thematroids
module. The rest come from #37835.⌛ Dependencies
#37835: Deeper improvements of
DisjointSet
.